package mysql

import "gorm.io/gorm"

type Reservation struct {
	gorm.Model
	UserId             int    `gorm:"type:int(11)" json:"UserId,omitempty"`
	ReservationSn      string `gorm:"type:varchar(50)" json:"ReservationSn,omitempty"`
	PayTimes           string `gorm:"type:varchar(50)" json:"PayTimes,omitempty"`
	ReservationRealkey string `gorm:"type:varchar(50)" json:"ReservationRealkey,omitempty"`
	ReservationStatus  string `gorm:"type:varchar(50)" json:"ReservationStatus,omitempty"`
}
type AppointmentDetails struct {
	gorm.Model
	HouseId int64   `form:"type:int(11)" json:"HouseId,omitempty"`
	Title   string  `form:"type:varchar(30)" json:"title,omitempty"`
	Info    string  `form:"type:varchar(30)" json:"info,omitempty"`
	Price   float64 `form:"type:decimal(10,2)" json:"price,omitempty"`
	Num     int64   `form:"type:int(11)" json:"num,omitempty"`
	Image   string  `form:"type:varchar(200)" json:"image,omitempty"`
	UserId  int     `form:"type:int(11)" json:"userId,omitempty"`
	Audit   int     `form:"type:int(11)comment 1 审核通过 2 审核未通过 3 未审核" json:"audit,omitempty"`
}

func (r *Reservation) Create() error {
	return DB.Create(&r).Error
}
func (a *AppointmentDetails) Create() error {
	return DB.Create(&a).Error
}
func (r *Reservation) FindSn() error {
	return DB.Where("ReservationSn =  ?", r.ReservationSn).Limit(1).Find(&r).Error
}
